package factory_pattern.calculator02;

/**
 * @Author xiumu
 * @Date 2019/2/27 20:09
 */
public class OperatorFactory {
    public static Calculator createOperator(char oper){
        Calculator calculator = null;
        switch (oper){
            case '+':
                 calculator = new OperatorAdd();
                break;
            case '-':
                calculator = new OperatorSub();
                break;
            case '*':
                calculator = new OperatorMul();
                break;
            case '/':
                calculator = new OperatorDiv();
                break;
        }
        return calculator;
    }
}
